<template>
  <div class="report-form-content">
    <van-tabs :active="active1" type="card" :animated="true" :swipeable="true">
      <van-tab title="合同请款">
        <div class="shenpilist"  v-if="obj">
          <label>请款金额：</label>
          <span>{{ obj.cashAmount }}</span>
        </div>
        <div class="shenpilist"  v-if="obj">
          <label>请款状态：</label>
          <span><EnumTag :enum-list="getEnumList('ContractInitialCashState')" :enum-key="obj.state" /></span>
        </div>
        <div class="shenpilist" v-if="obj">
          <label>请款类型：</label>
          <span><DictTag :dict-list="getDictList('ContractInitialCashType')" :dict-key="obj.cashType" /></span>
        </div>
      </van-tab>
      <van-tab title="合同详情">
        <contractMainDetail v-if="obj" :contractInitialId="obj.contractInitialId" />
      </van-tab>
    </van-tabs> 
  </div>
</template>
<script setup>
import {ref, watch} from 'vue'
import {doGet} from "@/config/http";
import {svc} from "@/config/common";
import contractMainDetail from '@/h5/components/contractMainDetail.vue'

const props = defineProps({
  contractCashId: {
    required: true,
    type: String,
  }
})
let active1 = ref(0)
let obj = ref(null)

const initObj = async (val) =>  {
  if (val) {
    obj.value = await doGet(svc, `/contract-initial-cash/${val}`, {}, true) 
  }
}

watch(() => props.contractCashId, async val => {
  await initObj(val)
  // await initList()
},{immediate:true})

</script>

<style scoped lang="scss">
.report-form-content {
  width: 100%;
  height: 52vh;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 1.25rem;
}
.update-log {
  width: 100%;
  margin: 30px 0;
}
.tabs-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tabs-form-head span {
  font-size: 18px;
  color: #303133;
  font-weight: bold;
}
.shenpilist {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--van-cell-background);
  box-sizing: border-box;
  width: 100%;
  padding: var(--van-cell-vertical-padding) var(--van-cell-horizontal-padding);
  overflow: hidden;
  color: var(--van-cell-text-color);
  font-size: var(--van-cell-font-size);
  // line-height: var(--van-cell-line-height);
  border-bottom: 1px solid var(--van-border-color);;
  & label {
    color: var(--van-field-label-color);
    // text-align: left;
    word-wrap: break-word;
    font-weight: 700;
  }
  & span {
    display: block;
    box-sizing: border-box;
    // width: 100%;
    color: var(--van-field-input-text-color);
    line-height: inherit;
    // text-align: left;
    background-color: transparent;
    border: 0;
    resize: none;
    -webkit-user-select: auto;
    user-select: auto;
  }
}
</style>
